Conversation
| } | ||
|
|
||
| #[derive(Debug, Clone, PartialEq, Eq)] | ||
| pub enum LogLevel { |
|
|
||
| fn color(&self) -> Color32 { | ||
| match self { | ||
| LogLevel::Error => Color32::from_rgb(255, 85, 85), // Bright red |
There was a problem hiding this comment.
These colors should be defined as consts somewhere
| } | ||
|
|
||
| impl LogEntry { | ||
| fn parse(line: &str) -> Option<Self> { |
There was a problem hiding this comment.
Instead of parsing log lines, we should refactor LineBuffer to store unformatted log lines, and then you won't need LogEntry either
| } | ||
| } | ||
|
|
||
| fn filtered_logs(&self) -> Vec<&LogEntry> { |
There was a problem hiding this comment.
Filtering should be set in the tracing filter for the log buffer, in app/main.rs.
|
|
||
| // Main log view | ||
| // Create a clone of the filtered logs to avoid borrow issues | ||
| let filtered_logs: Vec<LogEntry> = self.filtered_logs().iter().map(|&log| log.clone()).collect(); |
There was a problem hiding this comment.
Cloning the logs could be extremely expensive! This should be avoided if possible
| && !self.running_command.load(atomic::Ordering::SeqCst), | ||
| command_input, | ||
| // Parse logs from the line buffer | ||
| self.parse_logs(); |
There was a problem hiding this comment.
Parsing all logs from the line buffer on each update could be very expensive. If you must process the log lines, either do it in the line buffer, or use streams so that only new log lines get parsed
| ); | ||
|
|
||
| if command_input_resp.ctx.input_mut(|input| { | ||
| input.consume_key(Modifiers::NONE, Key::Enter) |
There was a problem hiding this comment.
How can the user input a multiline command? I think it is best to preserve the existing behavior with Shift+Enter
| } | ||
|
|
||
| if ui.button("Run").clicked() && app.is_some() && !self.running_command.load(atomic::Ordering::SeqCst) { | ||
| self.console_command(app.unwrap()); |
There was a problem hiding this comment.
If it is safe to unwrap app here, then you should also do so when accepting a new command with the Enter key
This PR includes significant improvements to the log viewer.
Thunder.Log.Viewer.mov